<template>
  <view class="content">
    <view class="fw mgbt fz16 tac">{{news.keyValue}}</view>
    <!--		<view class="color9 mgbt fz12">{{getTime(news.createTime)}}</view>-->
    <!--		<image class="image mgbt" :src="news.newsImg" mode=""></image>-->
    <!--		<view  :class="'color9 '+ [isAllScreen ? 'all-screen-bar' : 'normal-bar']"  v-html="news.content">-->

    <!--		</view>-->
    <view class="u-content">
      <u-parse :content="news.content"></u-parse>
    </view>
  </view>
</template>

<script>
import {
  miniDetail
} from '../../api/index.js'
import config from '@/common/config'
export default {
  data() {
    return {
      news: {},
      isAllScreen:config.isAllScreen,
    };
  },
  onLoad(option) {
    this.getDetail(option.id)
  },
  methods: {
    onShareAppMessage() {
      return {
        title: this.news.title,
        success: function(res) {
          // 转发成功
        },
        fail: function(err) {
          // 转发失败
        }
      }
    },
    getDetail(id) {
      miniDetail({
        id: id
      }).then(res => {
        this.news = res.data
      })
    },
    //时间戳转换
    getTime(time) {
      let data = new Date(time);
      let year = data.getFullYear();
      let month = data.getMonth() + 1;
      let day = data.getDate();
      let h = data.getHours();
      let mm = data.getMinutes();
      let s = data.getSeconds();
      month = month >= 10 ? month : "0" + month;
      day = day >= 10 ? day : "0" + day;
      h = h >= 10 ? h : "0" + h;
      mm = mm >= 10 ? mm : "0" + mm;
      s = s >= 10 ? s : "0" + s;
      return `${year}-${month}-${day} ${h}:${mm}:${s}`;
    },
  }
}
</script>

<style lang="scss">
.u-content {
  padding: 24rpx;
}
.content {
  padding: 30rpx;

  .image {
    width: 100%;
  }
  .all-screen-bar{padding-bottom: 40rpx;}
  .normal-bar{padding-bottom: 0;}
  .mgbt {
    margin-bottom: 40rpx;
  }
}
</style>